// run: $exec > input7_7
#include <algorithm>
#include <iostream>
#include <vector>

int calc(int x)
{
	int s = 1;
	for (int i = 2; i <= x; i++) s *= i;
	return s;
}

int main()
{
	int n = 7;
	std::vector<int> v;
	for (int i = 1; i <= n; i++) v.push_back(i);
	std::cout << 720 << '\n';
	int p = 7;
	int ti = 0;
	do {
		if (720 * (p - 1) <= ti && ti < 720 * p) {
			std::cout << n << '\n';
			for (auto i : v) std::cout << i << ' ';
			std::cout << '\n';
		}
		if (ti > 720 * p) break;
		ti++;
	} while (std::next_permutation(v.begin(), v.end()));
}
